<table width="100%"><tr><td width="20%">
<a href="../index.html">&lt; index</a><br />
<a href="index.html">&lt; 5. Image toolkit</a>
</td><td width="60%">
<p align="center">
=====================================<br />
5.5 Getting the size of an image<br />
=====================================<br />
</p></td><td width="20%">
</td></tr></table>
<style type="text/css">
.code { color:#444444; background-color:#EEEEEE;}
pre { color:#444444; background-color:#EEEEEE;}
table.param td { border : 1px solid #000000; }
th { background-color: #44BBFF; color: #FFFFFF }
table.none td { border : 0 }
</style>
You can read the size of an image in pixels with :<br />
<p class="code"><pre>
C++ : void TCODImage::getSize(int *w,int *h) const
C   : void TCOD_image_get_size(TCOD_image_t image, int *w,int *h)
Py  : image_get_size(image) # returns w,h
</pre></p>
<table class="param">
<tr><th>Parameter</th><th>Description</th></tr>
<tr><td>image</td><td>In the C version, the image handler, obtained with the <a href="image_load.html">load</a> function.</td></tr>
<tr><td>w,h</td><td>When the function returns, those variables contain the size of the image.</td></tr>
</table>
Example :<br />
<p class="code"><pre>
C++ : TCODImage *pix = new TCODImage(80,50);
      int w,h;
      pix->getSize(&w,&h); // w = 80, h = 50
C   : TCOD_image_t pix = TCOD_image_new(80,50);
      int w,h;
      TCOD_image_get_size(pix,&w,&h); /* w = 80, h = 50 */
Py  : pix = libtcod.image_new(80,50)
      w,h=libtcod.image_get_size(pix)
      # w = 80, h = 50 
</pre></p>
